<template>
  <el-dialog v-dialogDrag
             title="执行器详情"
             :close-on-click-modal="true"
             append-to-body
             :visible.sync="visible">
    <div style="height: 600px;overflow-y: scroll; padding-right: 10px;">


    <el-divider content-position="left" style="color: darkviolet;">执行器信息：</el-divider>

    <el-form :model="agentForm" :rules="dataRule" ref="agentForm"
             class="rdonly" label-width="140px">
      <!--<el-row>
        <el-col :span="12">
          <el-form-item label="主键" prop="id">
            <el-input v-model="agentForm.id" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="任务执行日志ID" prop="taskExecLogId">
            <el-input v-model="agentForm.taskExecLogId" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>-->
      <el-row>
        <el-col :span="12">
          <el-form-item label="作业执行日志ID" prop="jobExecLogId">
            <el-input v-model="agentForm.jobExecLogId" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="任务触发时间戳" prop="taskTriggerTime">
            <el-input v-model="agentForm.taskTriggerTime" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <!--<el-row>
        <el-col :span="12">
          <el-form-item label="地域编号" prop="azCode">
            <el-input v-model="agentForm.azCode" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="分库编号" prop="dbCode">
            <el-input v-model="agentForm.dbCode" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>-->
      <el-row>
        <!--<el-col :span="12">
          <el-form-item label="异常错误累计次数" prop="execErrorNum">
            <el-input v-model="agentForm.execErrorNum" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>-->
        <el-col :span="12">
          <el-form-item label="代理实例IP" prop="agentIpv4">
            <el-input v-model="agentForm.agentIpv4" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="12">
          <el-form-item label="执行日期" prop="execDate">
            <el-input v-model="agentForm.execDate" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="应用模式" prop="appMode">
            <el-input v-model="agentForm.appMode" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="应用名称" prop="appJarName">
            <el-input v-model="agentForm.appJarName" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="运行模式" prop="appRunMode">
            <el-input v-model="agentForm.appRunMode" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="执行启动命令" prop="execStartupCmd">
            <el-input type="textarea" :autosize="{ minRows: 1, maxRows: 8}"
                      v-model="agentForm.execStartupCmd" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="执行状态" prop="execStatus">
            <el-input v-model="agentForm.execStatus" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="执行结果" prop="execResult">
            <el-input type="textarea" :autosize="{ minRows: 1, maxRows: 8}"
                      v-model="agentForm.execResult" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="启动时间" prop="startupTime">
            <el-input v-model="agentForm.startupTime" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="结束时间" prop="endTime">
            <el-input v-model="agentForm.endTime" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>

        <!--<el-col :span="12">
          <el-form-item label="创建时间" prop="createTime">
            <el-input v-model="agentForm.createTime" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="更新时间戳" prop="updateTime">
            <el-input v-model="agentForm.updateTime" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>-->
      </el-row>
    </el-form>

      <el-divider content-position="left" style="color: darkviolet;">任务作业信息：</el-divider>

      <el-form :model="dataForm" :rules="dataRule" ref="dataForm"
               class="rdonly" label-width="140px">
        <!--<input type="hidden" id="id" name="id" >-->
        <el-row>
          <el-col :span="12">
            <el-form-item label="批次执行日志ID" prop="batchExecLogId">
              <el-input v-model="dataForm.batchExecLogId" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="任务执行日志ID" prop="taskExecLogId">
              <el-input v-model="dataForm.taskExecLogId" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="业务系统编号" prop="bizCode">
              <el-input v-model="dataForm.bizCode" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="批次编号" prop="batchCode">
              <el-input v-model="dataForm.batchCode" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="任务编号" prop="taskCode">
              <el-input v-model="dataForm.taskCode" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="任务作业编号" prop="jobCode">
              <el-input v-model="dataForm.jobCode" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="批次触发时间戳" prop="batchTriggerTime">
              <el-input v-model="dataForm.batchTriggerTime" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="任务触发时间戳" prop="taskTriggerTime">
              <el-input v-model="dataForm.taskTriggerTime" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="执行日期" prop="execDate">
              <el-input v-model="dataForm.execDate" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="执行状态" prop="execStatus">
              <el-input v-model="dataForm.execStatus" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="执行参数" prop="execParams">
              <el-input type="textarea" :autosize="{ minRows: 1, maxRows: 8}" v-model="dataForm.execParams" class="rdonly"
                        :readonly="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>

          <el-col :span="12">
            <el-form-item label="执行离开码" prop="exitCode">
              <el-input v-model="dataForm.exitCode" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="执行结果" prop="execResult">
              <el-input type="textarea" :autosize="{ minRows: 1, maxRows: 8}"
                        v-model="dataForm.execResult" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="启动时间" prop="startupTime">
              <el-input v-model="dataForm.startupTime" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="结束时间" prop="endTime">
              <el-input v-model="dataForm.endTime" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="创建时间" prop="createTime">
              <el-input v-model="dataForm.createTime" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="更新时间戳" prop="updateTime">
              <el-input v-model="dataForm.updateTime" class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="执行结果详细" prop="execResultDetailed">
              <el-input type="textarea" :autosize="{ minRows: 1, maxRows: 8}" v-model="dataForm.execResultDetailed"
                        class="rdonly" :readonly="true"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>

    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="visible = false">关闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data() {
      return {
        rowData: {},
        visible: false,
        dataForm: {},
        dataRule: {},
        agentForm: {},
      }
    },
    methods: {
      init(id, data) {
        this.visible = true
        this.rowData = data
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields();
        })
        this.queryAgent();
        this.queryList();
      },
      queryAgent(){
        let obj = {
          'id': this.rowData.id,
          'jobExecLogId': this.rowData.jobExecLogId,
          'taskTriggerTime': this.rowData.taskTriggerTime
        }
        //obj = Object.assign(obj, this.searchForm)
        this.getTableList('/api/agent/exec/log/detail', obj, (data) => {
          this.agentForm = []
          this.dataListLoading = false
          if (data.code == '000000') {
            this.agentForm = data
          }
        })
      },
      // 获取数据列表
      queryList() {
        this.dataListLoading = true
        let obj = {
          'id': this.rowData.jobExecLogId,
          'taskTriggerTime': this.rowData.taskTriggerTime
        }
        //obj = Object.assign(obj, this.searchForm)
        this.getTableList('/api/jobExec1Log/detail', obj, (data) => {
          this.dataForm = []
          this.dataListLoading = false
          if (data.code == '000000') {
            this.dataForm = data
          }
        })
      },
    }
  }
</script>
